package com.keldian.mobilesafe.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.keldian.mobilesafe.R;
import com.keldian.mobilesafe.utils.SharePrefenceTool;

/**
 * Created by Administrator on 15-12-14.
 */
public class LostFindActivity extends Activity {
    private TextView tv_safenumber;
    private ImageView iv_protecting;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        if (SharePrefenceTool.getFD(this)) {
            setContentView(R.layout.activity_lost_find);
            tv_safenumber = (TextView) findViewById(R.id.tv_safenumber);
            iv_protecting = (ImageView) findViewById(R.id.iv_protecting);
            //得到我们设置的安全号码
            String safenumber = SharePrefenceTool.getSafeMobile(this);
            tv_safenumber.setText(safenumber);
            //设置防盗保护的状态
            boolean protecting = SharePrefenceTool.getProtecting(this);
            if (protecting) {
                //已经开启防盗保护
                iv_protecting.setImageResource(R.drawable.lock);
            } else {
                //没有开启防盗保护
                iv_protecting.setImageResource(R.drawable.unlock);
            }

        } else {
            Intent intent = new Intent(this, Setup1Activity.class);
            startActivity(intent);
            finish();
        }

    }

    /**
     * 重新进入手机防盗设置向导页面
     *
     * @param view
     */
    public void reEnterSetup(View view) {
        Intent intent = new Intent(this, Setup1Activity.class);
        startActivity(intent);
        //关闭当前页面
        finish();
    }
}
